<?php
App::uses('AppModel', 'Model');
/**
 * StatutDemande Model
 *
 * @property Demande $Demande
 */
class StatutDemande extends AppModel {

/**
 * Display field
 *
 * @var string
 */
	public $displayField = 'label';
	
	public static $statuts = array("En attente"=>1 , "Accepte"=>2, "Refuse"=>3, "En cours"=>4, "Termine"=>5);
/**
 * Validation rules
 *
 * @var array
 */
	public $validate = array(
		'label' => array(
			'notEmpty' => array(
				'rule' => array('notEmpty'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
	);

	//The Associations below have been created with all possible keys, those that are not needed can be removed

/**
 * hasMany associations
 *
 * @var array
 */
	public $hasMany = array(
		'Demande' => array(
			'className' => 'Demande',
			'foreignKey' => 'statut_demande_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);
	
	public static function getLibelleByStatut($statut_id){
		return array_search($statut_id,self::$statuts);
	}	
	
	public static function getStatutEnAttente(){
		return self::$statuts["En attente"];
	}	
	
	public static function getStatutAccepte(){
		return self::$statuts["Accepte"];
	}	
	
	public static function getStatutRefuse(){
		return self::$statuts["Refuse"];
	}	
	
	public static function getStatutEnCours(){
		return self::$statuts["En cours"];
	}	
	
	public static function getStatutTermine(){
		return self::$statuts["Termine"];
	}

}
